package 软件工程实验三.A1.A14;//Source file: E:\\Projects\\RationRoseProject\\GenerateCode\\OrderDetail.java


import java.util.ArrayList;
import java.util.List;

public class OrderDetail
{
   private Integer quantity;
   public List<Product> theProduct = new ArrayList<>();
   public void addProduct(Product product)
   {
    theProduct.add(product);
   }
   public void removeProduct(Product product)
   {
    theProduct.remove(product);
   }
   
   /**
    * @roseuid 6719EB7100D9
    */
   public OrderDetail() 
   {
    
   }
   
   /**
    * @return Integer
    * @roseuid 6717146802CB
    */
   public Integer calculateSubTotal() 
   {
      int subTotal = 0;
      System.out.println("订单包含的物品:");
      for (Product product : theProduct) {
         subTotal += product.getPrice();
         System.out.println("\t" + product);
      }
      return subTotal;
   }
   
   /**
    * @return Integer
    * @roseuid 6717146A00EB
    */
   public Integer calculateWeight() 
   {
      int weight = 0;
      for (Product product : theProduct) {
         weight += product.getWeight();
      }
      return weight;
   }
}
